import Vue from 'vue'
import Router from 'vue-router'
import Book from '@/components/Book';

import PersonalCenter from "../components/PersonalCenter";
import Login from '@/components/Login';
import Home from '@/components/Home';
import MHome from "../components/MHome";
import Mbook from "../components/Mbook";
import Mordinaryuser from "../components/Mordinaryuser";
import Mpersonalborrowinginformation from "../components/Mpersonalborrowinginformation";
import Register from "../components/Register";
import index from "../components/index";
import Subscribe from "../components/Subscribe";
import PersonalBorrowingInformation from "../components/PersonalBorrowingInformation";
import Library from "../components/Library";
import Users from "../components/Users";
import Bookloss from "../components/Bookloss";
import Mbookloss from "../components/Mbookloss";
import Blacklist from "../components/Blacklist";
import Mblacklist from "../components/Mblacklist";

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
    {
      path: '/home',
      component: Home,
      meta:{
        isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
      },//路由元
      children: [
        {
          path: '/',
          name: 'index',
          component: index
        },
        {
          path: '/library',
          name: 'library',
          component:Library
        },
        {
          path: '/book',
          name: 'book',
          meta:{
            isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
          },//路由元
          component: Book
        },{
          path: '/personalCenter',
          name: 'personalCenter',
          meta:{
            isLogin:true    // 添加该字段，表示进入这个路由是需要登录的
          },//路由元
          component: PersonalCenter
        },{
          path: '/subscribe',
          name: 'subscribe',
          component: Subscribe
        },
        {
          path: '/personalBorrowingInformation',
          name: 'personalBorrowingInformation',
          component: PersonalBorrowingInformation
        },
        {
          path: '/bookloss',
          name: 'bookloss',
          component: Bookloss
        },{
          path: '/blacklist',
          name: 'blacklist',
          component: Blacklist
        }
      ]
    },


    {
      path: '/mhome',
      component: MHome,
      children: [
        {
          path: '/',
          name: 'mindex',
          component: index
        }, {
          path: '/mbookloss',
          name: 'mbookloss',
          component: Mbookloss
        },

        {
          path: '/mbook',
          name: 'mbook',
          component: Mbook
        },
        {
          path: '/mpersonalborrowinginformation',
          name: 'mpersonalborrowinginformation',
          component:Mpersonalborrowinginformation
        },{
          path: '/mordinaryuser',
          name: 'mordinaryuser',
          component:Mordinaryuser
        },{
          path: '/users',
          name: 'users',
          component:Users
        },{
          path: '/mlibrary',
          name: 'mlibrary',
          component:Library
        },
        {
          path: '/mblacklist',
          name: 'mblacklist',
          component:Mblacklist
        },]
    }
  ]
})
